import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Test {

    static Lock lock=new ReentrantLock();
    static int i=10;

    public static void main(String[] args) {
        final String a = new String("a");
        final String b = new String("");

        System.out.println(a.length());
        System.out.println(b.length());
        final ArrayBlockingQueue<Runnable> objects = new ArrayBlockingQueue<>(100);
        final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1,1,1l, TimeUnit.SECONDS,objects, new ThreadPoolExecutor.AbortPolicy());


        for (int i = 0; i < 10; i++) {
            lock.lock();
            try {
               new Thread(new A()).start();

            }catch (Exception e){
                e.printStackTrace();
            }finally {
                lock.unlock();
            }
        }
        System.out.println(i);
    }

    static class A implements Runnable{


        @Override
        public void run() {
            i--;
            System.out.println("--"+i);
        }
    }
}
